package com.woniuxy.joylifemarket.controller;

import com.woniuxy.common.entity.MarketMessage;
import com.woniuxy.joylifemarket.service.MarketMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class MessageController {
    @Autowired
    MarketMessageService marketMessageService;

    //初始化全部消息
    @RequestMapping("/initallmessages")
    public Object userAddress(String loginUserId) {
            Map<String, Object> result = new HashMap<>();
            try {
                List<MarketMessage> allMessagesBySendId = marketMessageService.findAllMessagesBySendId(loginUserId);
                result.put("code", 200);
                result.put("msg", "查询成功");
                result.put("data", allMessagesBySendId);
//                System.out.println("allAppraise"+allMessagesBySendId);
                return result;
            } catch (Exception e) {
                result.put("code", 500);
                result.put("msg", "查询失败");
                e.printStackTrace();
                return result;
            }
        }

}
